import request from '../utils/request'
import common from '@/assets/js/common.js'

export const queryProcessByOrg = ({ data, headers }) => {
  // 查询审批流程
  return request({
    url: common.base64DeCode(
      '4EF3267D4C2BA3BE19D7E9B0A9D509E25FA9E0E07A822761E6FB4D7E3E5401276D4876752BDDCAB03616DA77AC6003D3A9B33CB4F6BB3269DDC47898AB2ECF65'
    ).replace('/api-workflow',''), //'/api-workflow/wflow/process/model/queryProcessByOrg',

    method: common.base64DeCode('95F562C83E9DC158906711D6B8616121'),
    headers,
    data
  })
}

export const updateDefault = ({ data, headers }) => {
  // 设置默认审批流程
  return request({
    url: common.base64DeCode(
      '4EF3267D4C2BA3BE19D7E9B0A9D509E25FA9E0E07A822761E6FB4D7E3E540127E68C025191469CCFEE3D0AC9D8BA23D6'
    ).replace('/api-workflow',''), //'/api-workflow/wflow/process/model/updateDefault',

    method: common.base64DeCode('95F562C83E9DC158906711D6B8616121'),
    headers,
    data
  })
}

export const saveProcess = ({ data, headers }) => {
  // 保存审批流程
  return request({
    url: common.base64DeCode(
      '4EF3267D4C2BA3BE19D7E9B0A9D509E25FA9E0E07A822761E6FB4D7E3E54012727AFABE31B4C99AEE952D0C7D4BDBF8C'
    ).replace('/api-workflow',''), //'/api-workflow/wflow/process/model/save',

    method: common.base64DeCode('95F562C83E9DC158906711D6B8616121'),
    headers,
    data
  })
}

export const deployProcess = ({ data, headers }) => {
  // 部署审批流程
  return request({
    url:
      common.base64DeCode(
        '4EF3267D4C2BA3BE19D7E9B0A9D509E25FA9E0E07A822761E6FB4D7E3E540127DCC31218D94C4709B253B9B601765601'
      ).replace('/api-workflow','') + data.formId, //`/api-workflow/wflow/process/model/deploy/${formId}`,
    method: common.base64DeCode('95F562C83E9DC158906711D6B8616121'),
    headers
  })
}

export const deleteProcess = ({ data, headers }) => {
  // 删除审批流程
  return request({
    url:
      common.base64DeCode(
        '4EF3267D4C2BA3BE19D7E9B0A9D509E25FA9E0E07A822761E6FB4D7E3E540127732D6DF5C164A160E7750F573F462FD1'
      ).replace('/api-workflow','') + data.formId, //`/api-workflow/wflow/process/model/${formId}`,
    method: common.base64DeCode('B4DE073F8876DEC017FEBB9CDF69370E'),
    headers
  })
}

export const disableProcess = ({ data, headers }) => {
  // 停用审批流程
  return request({
    url:
      common.base64DeCode(
        '4EF3267D4C2BA3BE19D7E9B0A9D509E25FA9E0E07A822761E6FB4D7E3E540127CF66283379749DAA558FB7DC35ABB5A9'
      ).replace('/api-workflow','') + data.formId, //`/api-workflow/wflow/process/model/disable/${formId}`,
    method: common.base64DeCode('E5838BE416EC18E68EA65B8A3EB9C036'),
    headers
  })
}

export const enableProcess = ({ data, headers }) => {
  // 启用审批流程
  return request({
    url:
      common.base64DeCode(
        '4EF3267D4C2BA3BE19D7E9B0A9D509E25FA9E0E07A822761E6FB4D7E3E540127012EECF0251D118B371894E847463A07'
      ).replace('/api-workflow','') + data.formId, //`/api-workflow/wflow/process/model/enable/${formId}`,
    method: common.base64DeCode('E5838BE416EC18E68EA65B8A3EB9C036'),
    headers
  })
}

export const previewProcess = ({ data, headers }) => {
  // 预览流程详情
  return request({
    url:
      common.base64DeCode(
        '4EF3267D4C2BA3BE19D7E9B0A9D509E25FA9E0E07A822761E6FB4D7E3E540127732D6DF5C164A160E7750F573F462FD1'
      ).replace('/api-workflow','') + data.formId, //`/api-workflow/wflow/process/model/${formId}`,
    method: common.base64DeCode('CBCAF99642BBB033F8BEAA6EE2D86CDF'),
    headers
  })
}

export const copyProcess = ({ data, headers }) => {
  // 复制审批流程
  return request({
    url: common.base64DeCode(
      '4EF3267D4C2BA3BE19D7E9B0A9D509E25FA9E0E07A822761E6FB4D7E3E540127A0761E498861E9A228DEC12BADF2A876'
    ).replace('/api-workflow',''), //`/api-workflow/wflow/process/model/copyProcess`,
    data,
    method: common.base64DeCode('95F562C83E9DC158906711D6B8616121'),
    headers
  })
}

export const uploadFile = ({ data, headers }) => {
  // 上传文件
  return request({
    url: '/infra/file/upload', //`/api-file/file/uploadFile`,
    data,
    method: common.base64DeCode('95F562C83E9DC158906711D6B8616121'),
    headers
  })
}

export const saveSealProcess = ({ data, headers }) => {
  // 用印发布流程
  return request({
    url: common.base64DeCode(
      '54AF2D6F924DCC930ED99B8972E4268D96EA045E185E241BCFD2553BC1876B5F04BD91133E9F22490F12B33F79FA2A0A'
    ).replace('/api-contract',''), //`/api-contract/contract/saveSealProcess`,
    data,
    method: common.base64DeCode('95F562C83E9DC158906711D6B8616121'),
    headers
  })
}

export const updateSeal = ({ data, headers }) => {
  // console.log(common.Encrypt('/api-ca/seal/updateSeal'))
  // 印章绑定流程
  return request({
    url: common.base64DeCode('4FFA18FDE83A5E0CB7DBF259CCB1C9991B43D0BBDE2A2C8BD6FBCB37D42236EB').replace('/api-ca',''), //`/api-ca/seal/updateSeal`,
    data,
    method: common.base64DeCode('95F562C83E9DC158906711D6B8616121'),
    headers
  })
}
